<!DOCTYPE html>
<html xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"
      xmlns:th="http://www.thymeleaf.org">
<head th:include="/include/commonHeader::commonHeader('规则详情')"></head>
<body class="gray-bg layer-blue">
<script src="/js/jquery-ui.min.js"></script>
<div class="wrapper wrapper-content animated fadeInRight full-container  full-height">
    <div class="row" id="container">
        <div class="col-xs-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <div class="row">
                        <div class="col-sm-3 col-xs-12">
                            <div class="row">
                                <label class="col-sm-4 col-xs-2 text-right">日期:</label>
                                <span class="col-sm-8 col-xs-10 info-label" th:text="${#dates.format(flightDate,'yyyy-MM-dd')}"></span>
                            </div>
                        </div>
                        <div class="col-sm-3 col-xs-12">
                            <div class="row">
                                <label class="col-sm-4 col-xs-2 text-right">连线:</label>
                                <span class="col-sm-8 col-xs-10 info-label" th:text="${#dates.format(flightDate,'yyyy-MM-dd')}"></span>
                            </div>
                        </div>
                    </div>
                    <table id="table" data-classes="table table-hover table-condensed">
                        <thead>
                        <tr>
                            <th data-field="id" data-formatter="orderFormatter" data-width="40" data-valign="middle" data-halign="center">序号</th>
                            <th data-field="cName" data-valign="middle" data-halign="center">人员</th>
                            <th data-field="verificationResult" data-valign="middle" data-halign="center">规则</th>
                            <th data-field="result" data-formatter="resultFormatter" data-valign="middle" data-halign="center">结果</th>
                        </tr>
                        </thead>

                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<script th:inline="javascript">

    var dutyCode = [[${dutyCode}]];//dutyCode
    var flightDate = [[${flightDate}]];//flightDate
    var crewLinkLineNo = [[${crewLinkLineNo}]];//crewLinkLineNo

    var docHeight = $(document).height(); //内容区域高度，根据百分比计算排班管理高度

    $(document).ready(function () {
        $.ajax({
            url: param.url,
            dataType: 'json',
            async: false,
            cache: false,
            data: param.data ? param.data : {},
            success: function (data) {
                $("#table").bootstrapTable("destroy").bootstrapTable({
                    data:'',
                    clickToSelect: true,
                    singleSelect: true,
                    showRefresh: false,                  //是否显示刷新按钮
                    striped: true,//行间隔色
                    locale: "${language}",
                    uniqueId: 'crewLinkLineId',
                    height: docHeight * 0.75,
                    queryParams: function (params) {
                        var result = {
                            flightDate: $("#flightDate").val(),
                            dutyCode:dutyCode
                        };
                        return result;
                    },
                    onClickRow: function (row, $element, field) {
                        $element.addClass("info").siblings().removeClass("info");
                    },
                    onLoadSuccess: function (data) {
                        //单元格可接收拖拽

                    },
                });
            },
            error: function (data) {
                result = [];
            }
        });

        $(window).resize(function () {
            $('#table').bootstrapTable('resetView');
        });
    });
    //规则分析结果格式化
    function resultFormatter(value, row, index, field){
        if(value == 'Y'){
            return '通过';
        }else if(value == 'N'){
            return '不通过';
        }else{
            return '';
        }
    }
</script>
</body>
</html>